<%@ taglib prefix="page" uri="http://com.qipay/pagelib" %>
<%@ page language="java" import="com.qipay.admin.cp.vo.CpInfoDTO" contentType="text/html;charset=utf-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.List" %>
<%@ page import="com.qipay.order.vo.CpTjVo" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.qipay.admin.utils.SiteHelper" %>
<%@ page import="com.qipay.order.vo.ChannelTjVo" %>
<!doctype html>
<html>
<head>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <jsp:include page="head.jsp"></jsp:include>
    <link rel="stylesheet" href="<%= request.getAttribute("StaticHost") %>/css/dataTables.bootstrap.min.css">
    <link rel="stylesheet" href="<%= request.getAttribute("StaticHost") %>/css/bootstrap-datepicker3.min.css">
    <link rel="stylesheet" href="<%= request.getAttribute("StaticHost") %>/css/datetimepicker.css">
    <link rel="stylesheet" href="<%= request.getAttribute("StaticHost") %>/css/list.css">
    <script type="text/javascript">
        document.getElementsByTagName("html")[0].style.fontSize=screen.availWidth/200+"px";
    </script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <jsp:include page="nav.jsp"></jsp:include>
    <jsp:include page="left.jsp"></jsp:include>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            <h3 class="box-title">支付方式分析</h3>
                        </div>
                        <div>
                            <%
                                Map<String, String> params = (Map<String, String>) request.getAttribute("params");
                            %>
                            <form id="searchForm" action="/data/channel" >
                                <div class="new-group date form_datetime">
                                    <label for="from">开始日期：</label>
                                    <input type="text" id="from" name="from" readonly
                                           value="<%= params.containsKey("from") ?params.get("from"):""%>" data-date-format="yyyy-mm-dd hh:ii">
                                </div>
                                <div class="new-group date form_datetime">
                                    <label for="to">结束日期：</label>
                                    <input type="text" id="to" name="to" readonly
                                           value="<%= params.containsKey("to") ?params.get("to"):""%>" data-date-format="yyyy-mm-dd hh:ii">
                                </div>

                                <div class="new-group" >
                                    <label for="channelid">支付方式：</label>
                                    <select id="channelid" name="channelid">
                                        <%
                                            Map<Integer, String> channelMap = (Map<Integer, String>) request.getAttribute("channels");
                                            int  channel=params.containsKey("channelid") ? Integer.valueOf(params.get("channelid")) : 0;
                                            for (int key : channelMap.keySet()) {
                                                String value = channelMap.get(key);
                                        %>
                                        <option value="<%=key%>"
                                                <% if (Integer.valueOf(channel).equals(key)) {%>
                                                selected="selected"<%}%>>
                                            <%=value%>
                                        </option>
                                        <%}%>
                                    </select>
                                </div>
                                <button type="submit" class="button back-green" id="btnSearch" style="font-size: 1rem">查询</button>
                            </form>
                        </div>
                        <div style="clear: both"></div>
                        <!-- /.box-header -->
                        <div class="tableContent">
                            <table  width="100%" cellpadding="0" cellspacing="0" border="1">
                                <thead>
                                <tr>
                                    <th width="20%">支付方式</th>
                                    <th width="10%">订单数量</th>
                                    <th width="10%">成交数量</th>
                                    <th width="10%">成功率</th>
                                    <th width="10%">支付总金额</th>
                                    <th width="10%">单笔平均</th>
                                    <th width="10%">单笔最大</th>
                                    <th width="10%">交易所占比</th>
                                </tr>
                                </thead>
                                <tbody>
                                <% List<ChannelTjVo> articles = ( List<ChannelTjVo>) request.getAttribute("list");
                                    if (articles != null && articles.size() > 0) {
                                        Iterator<ChannelTjVo> iter = articles.iterator();
                                        ChannelTjVo user = null;
                                        while (iter.hasNext()) {
                                            user = iter.next();
                                %>
                                <tr>
                                    <td>
                                        <%= user.getChannelType()%>
                                    </td>
                                    <td>
                                        <%= user.getAllNum()%>
                                    </td>
                                    <td>
                                        <%= user.getPayNum()%>
                                    </td>
                                    <td>
                                        <%= user.getSuccessRate()%>%
                                    </td>
                                    <td>
                                        <%=SiteHelper.formatMoney(user.getPayAmount(), 100.0)%>
                                    </td>
                                    <td>
                                        <%=SiteHelper.formatMoney(user.getPerAmount(), 100.0)%>
                                    </td>
                                    <td>
                                        <%=SiteHelper.formatMoney(user.getMaxAmount(), 100.0)%>
                                    </td>
                                    <td>
                                        <%=user.getTotal()%>%
                                    </td>
                                </tr>
                                <%
                                    }
                                } else {
                                %>
                                <tr>
                                    <td colspan="9">未找到数据</td>
                                </tr>
                                <% }%>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
    <jsp:include page="foot.jsp"></jsp:include>
</div>
<script src="<%= request.getAttribute("StaticHost") %>/js/bootstrap-datepicker.min.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/bootstrap-datepicker.zh-CN.min.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/dataTables.bootstrap.min.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/adminlte.min.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/bootstrap-datetimepicker.min.js"></script>

<script>
    $('#from, #to').datetimepicker({
        autoclose: true,
        todayBtn: true,
        clearBtn: true,
        language: "zh-CN"});
</script>
</body>
</html>

